import scrapy


class A生产者Spider(scrapy.Spider):
    name = "生产者"
    async def start(self):
        yield scrapy.Request('https://quotes.toscrape.com/')

    def parse(self, response):
        items = response.xpath('//div[@class="container"]//div[@class="col-md-8"]/div')
        for item in items:
            text = item.xpath('./span[@class="text"]/text()').extract_first()
            yield {
                'text': text,
            }
        href = response.xpath('//li[@class="next"]/a/@href').get()
        if href:
            yield response.follow(href, callback=self.parse)
